package surreal.triviamaster.beans;

/**
 * @author Michael
 *
 *This class is meant to represent one complete row from the Flags table in LocalCache
 */
public class Flag {
	
	private int id;
	private int questionId;
	private int listed;
	private int mineCorrect;
	private int inapropriate;
	private int incomplete;
	private String userAnswer;
	private String other;
	
	public Flag(int id, int questionId, int listed, int mineCorrect,
			int inapropriate, int incomplete, String userAnswer, String other) {
		super();
		this.id = id;
		this.questionId = questionId;
		this.listed = listed;
		this.mineCorrect = mineCorrect;
		this.inapropriate = inapropriate;
		this.incomplete = incomplete;
		this.userAnswer = userAnswer;
		this.other = other;
	}

	@Override
	public String toString() {
		return "Flag [id=" + id + ", questionId=" + questionId + ", listed="
				+ listed + ", mineCorrect=" + mineCorrect + ", inapropriate="
				+ inapropriate + ", incomplete=" + incomplete + ", userAnswer="
				+ userAnswer + ", other=" + other + "]";
	}

	/**
	 * The id from the local cache is not needed
	 * 
	 * @return All the values needed for the upload separated by semicolons
	 */
	public String toUploadString() {
		//if they are empty insert 'null'
		String tmpUA = userAnswer;
		String tmpOther = other;
		if(userAnswer.equals("")) {
			tmpUA = "null";
		}
		if(other.equals("")) {
			tmpOther = "null";
		}
		
		return  questionId + ";"
				+ listed + ";" + mineCorrect + ";"
				+ inapropriate + ";" + incomplete + ";"
				+ tmpUA + ";" + tmpOther;
	}
	
	public int getId() {
		return id;
	}
	public int getInapropriate() {
		return inapropriate;
	}
	public int getIncomplete() {
		return incomplete;
	}
	public int getListed() {
		return listed;
	}
	public int getMineCorrect() {
		return mineCorrect;
	}
	public String getOther() {
		return other;
	}
	public int getQuestionId() {
		return questionId;
	}
	public String getUserAnswer() {
		return userAnswer;
	}
	public void setId(int id) {
		this.id = id;
	}
	public void setInapropriate(int inapropriate) {
		this.inapropriate = inapropriate;
	}
	public void setIncomplete(int incomplete) {
		this.incomplete = incomplete;
	}
	public void setListed(int listed) {
		this.listed = listed;
	}
	public void setMineCorrect(int mineCorrect) {
		this.mineCorrect = mineCorrect;
	}
	public void setOther(String other) {
		this.other = other;
	}
	public void setQuestionId(int questionId) {
		this.questionId = questionId;
	}
	public void setUserAnswer(String userAnswer) {
		this.userAnswer = userAnswer;
	}

}
